<route lang="json5">
{
  style: {
    navigationStyle: 'default',
    navigationBarTitleText: '广告',
  },
}
</route>
<template>
  <div class=""></div>
</template>

<script setup lang="ts">
import { getAdvertise } from '@/service/advertise'
import { useStorage } from '@/utils/storage'
const { set } = useStorage()
// 广告
const toAdv = (target: string) => {
  uni.navigateTo({
    url: `/pages/advertisement/${target}/index`,
  })
}
const advInfo = ref<IAdvData>()
const getAdv = async () => {
  const res: IResData<IAdvData> = await getAdvertise()
  if (res.code === 1) {
    advInfo.value = res.data
    set('advInfo', res.data)
    if (res.data.adv_type === 1) {
      toAdv('imgText')
    } else if (res.data.adv_type === 2) {
      toAdv('video')
    }
  }
}
onLoad(() => getAdv())
</script>

<style scoped></style>
